<?php

/**
 * Pagination Refactor
 */
class PaginationObject
{
	private static $instance;
	
	function __construct()
	{
		self::$instance =& $this;
	}
	
	public static function getInstance()
	{
		if (self::$instance === NULL)
			self::$instance = new PaginationObject();
		
		return self::$instance;
	}
	
	public function createPaginationConfig($baseUrl, $totalRows, $curPage, $segment)
	{
		$config['base_url'] = base_url().$baseUrl;
		$config['total_rows'] = $totalRows;
		$config['per_page'] = REC_LIMIT;
		$config['uri_segment'] = $segment;
		$config['use_page_numbers'] = TRUE;
		
		$config['full_tag_open'] = "<div class='pagination' id='pagination'>";
		$config['full_tag_close'] = "</div>";
		
		if ($curPage == 0)
		{
			$config['prev_tag_open'] = "<span class=disabled>";
		}
		else {
			$config['prev_tag_open'] = "<span>";
		}
		$config['prev_tag_close'] = "</span>";
		
		return $config;
	}
}


?>